/*
 *Copyright (c) 2024 Black Sesame Technologies
 *
 *Licensed under the Apache License, Version 2.0 (the "License");
 *you may not use this file except in compliance with the License.
 *You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 *Unless required by applicable law or agreed to in writing, software
 *distributed under the License is distributed on an "AS IS" BASIS,
 *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *See the License for the specific language governing permissions and
 *limitations under the License.
*/

#ifndef _IPC_HW_CONFIG_H
#define _IPC_HW_CONFIG_H

#include "sys_base_reg.h"

#define IPC_HW_DEVICE IPC_HW_MSGBX

#define IPC_HW_LAYER_VERSION 1
#define IPC_HW_IS_32BIT 1

// reg addr definition
//#define MSGBX_BASE_ADDR MSGBOX_45_BASE_ADDR

#if defined(CORE0_FLAG)
    #define MSGBX_BASE_ADDR MSGBOX_01_BASE_ADDR
#elif defined(CORE1_FLAG)
    #define MSGBX_BASE_ADDR MSGBOX_23_BASE_ADDR
#else
    #error "CORE[x]_FLAG need define, x=0/1/2"
#endif


#define MSGBX_ADDR_WIDTH 12
#define MSGBX_DATA_WIDTH 32
#define MSGBX_DELAY_TIME_ADDR TIMER0_PWM0_BASE_ADDR
#define MSGBX_TIME_CLOCK    100000000

//isr num
#define MSGBX_FILTER_0_INTR SW_INTR_MSGBOX_INTR0
#define MSGBX_FILTER_1_INTR SW_INTR_MSGBOX_INTR1
#define MSGBX_FILTER_2_INTR SW_INTR_MSGBOX_INTR2
#define MSGBX_FILTER_3_INTR SW_INTR_MSGBOX_INTR3
#define MSGBX_FILTER_4_INTR SW_INTR_MSGBOX_INTR4
#define MSGBX_FILTER_5_INTR SW_INTR_MSGBOX_INTR5
#define MSGBX_FILTER_6_INTR SW_INTR_MSGBOX_INTR6
#define MSGBX_FILTER_7_INTR SW_INTR_MSGBOX_INTR7

// recv msg fifo depth
#define MSGBX_FILTER_END_NUM    4

// filter addr config fifo depth is 16
#define DEF_FILTER_ST_ADDR          (0)
#define DEF_FILTER_END_ADDR         (15)
#define DEF_FILTER_THRS             (1)

#define MSGBX_FLT1_ST_ADDR          (8)
#define MSGBX_FLT1_END_ADDR         (9)
#define MSGBX_FLT1_THRS             (1)

#define MSGBX_FLT2_ST_ADDR          (10)
#define MSGBX_FLT2_END_ADDR         (13)
#define MSGBX_FLT2_THRS             (1)

#define MSGBX_FLT3_ST_ADDR          (14)
#define MSGBX_FLT3_END_ADDR         (15)
#define MSGBX_FLT3_THRS             (1)

//default pid config
#define DEF_FILTER_PID_ST       0x0
#define DEF_FILTER_PID_END      0xFF
#define DEF_FILTER_PID_INVERT   0x0

// spec config bit
/*this bit is used for indicating if this end is shared by multi-environment*/
#define MSGBX_IS_SHARED_END 0


// bstipc state management enable
#define IPC_STATE_MGT_ENABLE
#define IPC_FLT_MGT_ENABLE


#endif